package com.ywger.service.result;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ywger.service.constants.Constant;

/**
 * @author chenmeng
 * @date 2018-05-03 13:41
 * @desc
 */
public class PageParam {

    private Integer pageSize;

    private Integer pageNum;

    public Integer getPageSize() {
        if(null == pageSize||pageSize<=0){
            pageSize = Constant.DEFAULT_PAGE_SIZE;
        }
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getPageNum() {
        if(null == pageNum||pageNum<=0){
            pageNum = 1;
        }
        return pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    @JsonIgnore
    public Long getSkip(){
        return ((long)getPageNum()-1)*getPageSize();
    }
}
